<?php
namespace console\controllers;

use Yii;
use yii\console\Controller;
use yii\helpers\Console;

/**
 * Class AppController
 * 
 * @author Xuegui Yuan <yuanxuegui@163.com>
 */
class AppController extends Controller
{

    public function actionSetup()
    {
        // db migrate
        \Yii::$app->runAction('migrate/up', [
            'interactive' => $this->interactive
        ]);
        \Yii::$app->runAction('rbac-migrate/up', [
            'interactive' => $this->interactive
        ]);
        \Yii::$app->runAction('message/migrate', [
            '@common/config/messages/php.php',
            '@common/config/messages/db.php'
        ]);
        
        if (Console::confirm('Install system modules')) {
            getModularityService()->installSystemModules();
        }
    }
}
